import requests
import random

# # 定义一个列表里面放入一些ua
# ua_list = [
#     "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/000000000 Safari/537.36 Edg/000000000",
#     "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/000000000 Safari/537.36 Edg/110.0.1587.69",
#     "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/000000000 Safari/537.36 Edg/110.0.1587.69",
#     "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/000000000 Safari/537.36 Edg/110.0.1587.69",
# ]
# headers = {
#     "user-agent": random.choice(ua_list)
# }

# from fake_useragent import UserAgent #使用ua库
# ua = UserAgent()
# headers = {
#     "user-agent": ua.random
# }
#
# res = requests.get('http://127.0.0.1:8000/useragent/',headers=headers)
#
# print(res.text)


# headers = {
#     "cookie": "sessionid=usfhiushfisufhsi"
# }
# # cookies = {
# #     "sessionid": "usfhiushfisufhsi"
# # }
# res = requests.get('http://127.0.0.1:8000/cookie/', headers=headers)
#
# print(res.text)


headers = {
    "referer": "http://wang.com/news"
}

res = requests.get('http://127.0.0.1:8000/referer/',headers=headers)
print(res.text)





